//
//  RecordCell.m
//  wtshoppingcite
//
//  Created by TW on 15-2-2.
//  Copyright (c) 2015年 TW. All rights reserved.
//

#import "RecordCell.h"

@implementation RecordCell


- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}

-(void)createSubViews{
    self.backgroundColor = [UIColor clearColor];
    
    _iconImageView = [[UIImageView alloc]initWithFrame:CGRectMake(5, (100-40)/2, 60, 40)];
    _iconImageView.image = [UIImage imageNamed:@"all_defalutImage"];
    [self.contentView addSubview:_iconImageView];
    
    _titleLabel = [self createLabelWithFrame:CGRectMake(_iconImageView.right + 5, 10, 220, 20) text:@"" font:16 textAli:NSTextAlignmentLeft textColor:MAIN_BLACK_COLOR];
    [self.contentView addSubview:_titleLabel];
    
    
    _subtitleLabel = [self createLabelWithFrame:CGRectMake(_iconImageView.right + 5, _titleLabel.bottom, 220, 20) text:@"" font:14 textAli:NSTextAlignmentLeft textColor:MAIN_GRAY_COLOR];
    [self.contentView addSubview:_subtitleLabel];
    
    _roomLabel = [self createLabelWithFrame:CGRectMake(_iconImageView.right + 5, _subtitleLabel.bottom, 220, 20) text:@"" font:14 textAli:NSTextAlignmentLeft textColor:MAIN_GRAY_COLOR];
    [self.contentView addSubview:_roomLabel];
    
    
}

-(UILabel*)createLabelWithFrame:(CGRect)frame text:(NSString*)text font:(int)font textAli:(NSTextAlignment)alig textColor:(UIColor*)tc{
    if(text == nil)
        text = @"";
    UILabel* label = [[UILabel alloc] initWithFrame:frame];
    label.text = text;
    label.font = [UIFont systemFontOfSize:font];
    label.textAlignment = alig;
    label.textColor = tc;
    label.backgroundColor = [UIColor clearColor];
    return label;
}


-(void)setRecordModel:(RecordModel *)recordModel{
    if (_recordModel != recordModel) {
        _recordModel = recordModel;
        
        _titleLabel.text =[NSString stringWithFormat:@"缴费时间:%@", recordModel.time];
        
        _subtitleLabel.text =[NSString stringWithFormat:@"缴费金额:%@", recordModel.waitFee];
        
        _roomLabel.text = [NSString stringWithFormat:@"缴费类型:%@", recordModel.type];
        
    }
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
